﻿<div class="jumbotron">
  <h1>ASP.NET</h1>
  <p class="lead">
    ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS, and
    JavaScript.
  </p>
  <p><a href="https://asp.net" class="btn btn-primary btn-lg">Learn more &raquo;</a></p>
</div>
<div class="row">
  <div class="col-md-4">
    <h2>Getting started</h2>
    <p>
      ASP.NET Web API is a framework that makes it easy to build HTTP services that reach
      a broad range of clients, including browsers and mobile devices. ASP.NET Web API
      is an ideal platform for building RESTful applications on the .NET Framework.
    </p>
    <p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301870">Learn more &raquo;</a></p>
  </div>
  <div class="col-md-4">
    <h2>Get more libraries</h2>
    <p>
      NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in
      Visual Studio projects.
    </p>
    <p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301871">Learn more &raquo;</a></p>
  </div>
  <div class="col-md-4">
    <h2>Web Hosting</h2>
    <p>
      You can easily find a web hosting company that offers the right mix of features and price for your applications.
    </p>
    <p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301872">Learn more &raquo;</a></p>
  </div>
</div>

@Scripts.Render("~/bundles/jquery")
<script>
  (() => {
    setTimeout(() => {
      $.ajax({
        url: '/api/user/login',
        type: 'get',
        data: { account: 'admin', password: '123456' },
        success: function (res) {
          let result = JSON.parse(res);
          sessionStorage.setItem('ticket', result.Ticket);
          getIndex();
        }
      });
    }, 5000);
  })();
  function getIndex() {
    $.ajax({
      url: '/api/user/index',
      beforeSend: function (xhr) {
        xhr.setRequestHeader('Authorization', "BasicAuth " + sessionStorage.getItem('ticket'));
      },
      type: 'get',
      data: {},
      success: function (res) {
        alert(res)
      }
    });
  }
</script>

